package net.kts.attraction.subway.positon.model;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Canvas;
import android.graphics.drawable.Drawable;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class SubwayPositionItemizedOverlay extends ItemizedOverlay<OverlayItem> {

	private Drawable marker = null;
	private List<OverlayItem> locationList = null;
	
	public SubwayPositionItemizedOverlay(Drawable defaultMarker) {
		super(defaultMarker);
		// TODO Auto-generated constructor stub
		this.marker = defaultMarker;
		this.locationList = new ArrayList<OverlayItem>();
	}
	
	public void addLocation(GeoPoint geoPoint, String title, String snippet) {
		
//		OverlayItem item = new OverlayItem(geoPoint, title, snippet);
		
		this.locationList.add( new OverlayItem(geoPoint, title, snippet));
		
		populate();
	}

	
	
	@Override
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		// TODO Auto-generated method stub
		super.draw(canvas, mapView, shadow);
		
		boundCenterBottom(this.marker);
	}

	@Override
	protected OverlayItem createItem(int i) {
		// TODO Auto-generated method stub
		return this.locationList.get(i);
	}

	@Override
	public int size() {
		// TODO Auto-generated method stub
		return this.locationList.size();
	}

}
